//
//  ProductCVCCell.m
//  InSuger
//
//  Created by dllo on 15/11/27.
//  Copyright © 2015年 Dior_3g. All rights reserved.
//

#import "ProductCVCCell.h"

@implementation ProductCVCCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell
{
    self.picImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, 3 * self.contentView.frame.size.height / 4)];
    [self.contentView addSubview:self.picImageView];
//    self.picImageView.backgroundColor = [UIColor greenColor];
    
    
    self.bottomImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 3 * self.contentView.frame.size.height / 4, self.contentView.frame.size.width, self.contentView.frame.size.height / 4)];
    [self.contentView addSubview:self.bottomImageView];
//    self.bottomImageView.backgroundColor = [UIColor blueColor];
    
    
    self.priveImageView = [[UIImageView alloc] initWithFrame:CGRectMake(2 * self.picImageView.frame.size.width / 3, 4 * self.picImageView.frame.size.height / 5, self.picImageView.frame.size.width - 2 * self.picImageView.frame.size.width / 3, self.picImageView.frame.size.height / 5)];
    [self.picImageView addSubview:self.priveImageView];
    self.priveImageView.layer.masksToBounds = YES;
    self.priveImageView.alpha = 0.8;
//    self.priveImageView.backgroundColor = [UIColor yellowColor];
    
    self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.priveImageView.frame.size.width, self.priveImageView.frame.size.height)];
    [self.priveImageView addSubview:self.priceLabel];
    self.priceLabel.font = [UIFont systemFontOfSize:13.0];
    self.priceLabel.textColor = [UIColor whiteColor];
    self.priceLabel.textAlignment = NSTextAlignmentCenter;
//    self.priceLabel.backgroundColor = [UIColor orangeColor];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:self.bottomImageView.frame];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.textColor = [UIColor grayColor];
    self.titleLabel.font = [UIFont systemFontOfSize:15.0];
//    self.titleLabel.backgroundColor = [UIColor blackColor];
    
    @weakify(self);
    [self addColorChangedBlock:^() {
        @strongify(self);
        
        self.contentView.nightBackgroundColor = UIColorFromRGB(0x343434);
        self.contentView.normalBackgroundColor = [UIColor whiteColor];
        self.priveImageView.nightBackgroundColor = UIColorFromRGB(0x343434);
        
        self.titleLabel.nightTextColor = [UIColor whiteColor];
    }];
}

@end
